<!--公共开始-->
<include file="./public" />
<!--公共结束-->
<title>7min理财</title>
<script type="text/javascript" src="__ROOT__/js/masonry-docs.min.js"></script><!--瀑布流插件-->
<script type="text/javascript">
var nextid = 0;
var item = '';
$(function() {
    var $container = $('#news-list'),
    sTimer;
    $container.imagesLoaded(function() {
        $container.masonry({
            itemSelector: '.card',
            gutter: 25,
			isAnimated: true
        })
    });
    $(window).scroll(function scrollHandler() {
        fixTop("#hotNews");//固定热门推荐
		
		
		clearTimeout(sTimer);		
        sTimer = setTimeout(function() {
            if (window.loaded == 1) {
                $(window).unbind("scroll", scrollHandler)
            }
            var c = document.documentElement.clientHeight || document.body.clientHeight,
            t = $(document).scrollTop();
			//alert(t+c+","+$container.offset().top+","+$container.height());
            if (t + c >= $container.offset().top + $container.height()) {
                loadMore();
            }
        },
        100)
    });
    var jLoading = $('#loading');
	
	
    function loadMore() {
		//alert(nextid);
		if(nextid == 0)
		{
		 // alert('game over');
		  
		}else
		{
		getmoreNews();
		var itemsJsWalls = [];
	
		itemsJsWalls.push(item);
		var $itemsJsWall = $(itemsJsWalls.join(''));
		   $itemsJsWall.imagesLoaded(function()
		   {
			$container.masonry('remove', jLoading).masonry();
			$container.append($itemsJsWall);
			$container.masonry('appended', $itemsJsWall, false);
		   });
		}
    }
	
	
	function getmoreNews(){
	$.ajax({  
				type: "post",  
				url: "__URL__/Ajaxgetnews",  
				dataType: 'json',
				data: {nextid:nextid},
				beforeSend: function(XMLHttpRequest){   
				},  
				error:function(){
					alert('error');
				},
				async : false,
				success: function(json)
				{
					if(json.status == 1){
					  nextid = json.info;
					  //alert(json.data.title);
					  if(json.data.covertype == 1)
					  {
					  item = "<div class='card card-pic'><div class='cardtitle'><a href='__URL__/newsCont/id/"+ json.data.id +"'><img src='{$picserver}"+json.data.picurl+"'></a><h2><a href='__URL__/newsCont/id/"+ json.data.id +"'>"+json.data.title+"</a></h2></div><div class='abstract'><p>"+ json.data.summary +"</p></div><div class='intera'><a title='推荐'class='btn-commend'><i class='fa fa-thumbs-o-up'></i><span class='btn-count'>0</span></a><span class='right'>"+ json.data.publishtime +"</span></div></div>";
					  }else if(json.data.covertype == 0)
					  {
					  item = "<div class='card card-nopic'><div class='cardtitle'><h2><a href='__URL__/newsCont/id/"+ json.data.id +"'>"+json.data.title+"</a></h2></div><div class='abstract'><p>"+ json.data.summary +"</p></div><div class='intera'><a title='推荐'class='btn-commend'><i class='fa fa-thumbs-o-up'></i><span class='btn-count'>0</span></a><span class='right'>"+ json.data.publishtime +"</span></div></div>";
					  }else
					  {
					  item = "<div class='card card-ban'><div class='cardtitle'><a href='__URL__/newsCont/id/"+ json.data.id +"'><img src='{$picserver}"+json.data.picurl+"'></a><h2><a href='__URL__/newsCont/id/"+ json.data.id +"'>"+json.data.title+"</a></h2></div><div class='abstract'><p>"+ json.data.summary +"</p></div><div class='intera'><a title='推荐'class='btn-commend'><i class='fa fa-thumbs-o-up'></i><span class='btn-count'>0</span></a><span class='right'>"+ json.data.publishtime +"</span></div></div>";
					  }
						  
					} else
					{
						alert('No more news!');
						nextid = 0;
						item = '';
						$('#loading').remove();
					}
				} 
			})
        
    }
    
	
	//固定热门推荐
	var top=$("#hotNews").offset().top;
	function fixTop(elem){
		var width=$(elem).width();
		if($(document).scrollTop()>top){
			
			$(elem).css({"position":"fixed","top":"0","width":width});
		}else{
			$(elem).css({"position":"","top":"","width":width});
		}
	}
	
});
</script>

</head>

<body>
<!--头部+顶部开始-->
<include file="./top" />
<!--头部+顶部结束-->

<!--主体开始-->
<div class="main-content">
    <div class="left70 left">
        <!--新闻列表-瀑布流 开始-->
        <div class="waterfall clearfix" id="news-list">
            
           
          <?php foreach($newslist as $k => $v):?>
            
            <?php if($v['covertype']==1){?>
            <div class="card card-pic">
                <div class="cardtitle">
                  <a href="__URL__/newsCont/id/<?php echo $v['id'];?>" title="{$v['title']}"><img src="{$picserver}{$v['picurl']}" /></a>
                  <h2>
                    <a href="__URL__/newsCont/id/{$v['id']}">{$v['title']}</a>
                  </h2>
                </div>
                <div class="abstract">
                  <p>{$v['summary']}</p>
                </div>
                <div class="intera">
                  <a title="推荐" class="btn-commend">
                    <i class="fa fa-thumbs-o-up"></i>
                    <span class="btn-count"><?php echo $v['praisecount'];?></span>
                  </a>
                  <span class="right">{$v['publishtime']}</span>
                </div>
            </div>
            <?php }?>
            
            
            <?php if($v['covertype']==0){?>          
            <div class="card card-nopic">
                <div class="cardtitle">
                  <h2>
                    <a href="__URL__/newsCont/id/<?php echo $v['id'];?>"><?php echo $v['title'];?></a>
                  </h2>
                </div>
                <div class="abstract">
                  <p><?php echo $v['summary'];?></p>
                </div>
                <div class="intera">
                  <a title="推荐" class="btn-commend">
                    <i class="fa fa-thumbs-o-up"></i>
                    <span class="btn-count"><?php echo $v['praisecount'];?></span>
                  </a>
                  <span class="right"><?php echo $v['publishtime'];?></span>
                </div>
            </div>  
            <?php }?>
            
            <?php if($v['covertype']==2){?>
            <div class="card card-ban">
                <div class="cardtitle">
                  <a href="__URL__/newsCont/id/<?php echo $v['id'];?>" title="{$v['title']}"><img src="{$v['picurl']}" /></a>
                  <h2>
                    <a href="__URL__/newsCont/id/{$v['id']}">{$v['title']}</a>
                  </h2>
                </div>
                <div class="abstract">
                  <p>{$v['summary']}</p>
                </div>
                <div class="intera">
                  <a title="推荐" class="btn-commend">
                    <i class="fa fa-thumbs-o-up"></i>
                    <span class="btn-count"><?php echo $v['praisecount'];?></span>
                  </a>
                  <span class="right">{$v['publishtime']}</span>
                </div>
            </div>
            <?php }?>
         
         <?php 
         $nextid = $v['id'];
         endforeach;        
         ?>
         
         <script type="text/javascript">
           var nextid = <?php echo $nextid;?>;		 
         </script>
            
        </div>
        <div id="loading">
        	<img src="__ROOT__/images/onload.gif"  />
        </div>
        <!--新闻列表-瀑布流 结束-->
    </div>
    <div class="right30 right">
        <!--行情中心-->
        <div class="panel">
            <div class="panel-body side-item">
                <h1><span>行情中心</span></h1>
                <div class="side-item-body hqzx">
                    <div class="hqzx_item">
                        <h2>股市</h2>
                        <div class="hqzx_table">
                            <table>
                              <tr>
                                <td width="180">沪深上证</td>
                                <td class="align-right"><span class="text-danger">{$dapanPrice['szzz']}</span></td>
                                <td class="align-right" width="90"><span class="text-danger">{$dapanRate['szzz']}</span></td>
                              
                              </tr>
                              <tr>
                                <td>沪深300</td>
                                <td class="align-right"><span class="text-success"> {$dapanPrice['hs300']} </span></td>
                                <td class="align-right"><span class="text-success"> {$dapanRate['hs300']} </span></td>
                               
                              </tr>
                              <tr>
                                <td>美股道琼斯</td>
                                <td class="align-right"><span class="text-success"> - </span></td>
                                <td class="align-right"><span class="text-success"> - </span></td>
                               
                              </tr>
                            </table>
                        </div>
                    </div>
                    <div class="hqzx_item">
                        <h2>外汇</h2>
                        <div class="hqzx_table">
                            <table>
                              <tr>
                                <td width="180">美元/人民币</td>
                                <td class="align-right"><span class="text-danger">{$dapanPrice['USD']}</span></td>
                                <td class="align-right" width="90"><span class="text-danger">{$dapanRate['USD']}</span></td>
                              
                              </tr>
                              <tr>
                                <td>欧元/美元</td>
                                <td class="align-right"><span class="text-success"></span></td>
                                <td class="align-right"><span class="text-success"></span></td>
                             
                              </tr>
                              <tr>
                                <td>港币/人民币</td>
                                <td class="align-right"><span class="text-success"></span></td>
                                <td class="align-right"><span class="text-success"></span></td>
                         
                              </tr>
                            </table>
                        </div>
                    </div>
                    <div class="hqzx_item">
                        <h2>黄金</h2>
                        <div class="hqzx_table">
                            <table>
                              <tr>
                                <td width="180">黄金</td>
                                <td class="align-right"><span class="text-danger">{$dapanPrice['hj']}</span></td>
                                <td class="align-right" width="90"><span class="text-danger">{$dapanRate['hj']}</span></td>
                               
                              </tr>
                              <tr>
                                <td></td>
                                <td class="align-right"><span class="text-success">-</span></td>
                                <td class="align-right"><span class="text-success">-</span></td>
                           
                              </tr>

                              <tr>
                                <td></td>
                                <td class="align-right"><span class="text-success">-</span></td>
                                <td class="align-right"><span class="text-success">-</span></td>
                              </tr>
                            </table>
                        </div>
                    </div>
                    <!--<div class="hqzx_item">
                        <h2>商品</h2>
                        <div class="hqzx_table">
                            <table>
                              <tr>
                                <td width="180">COMEX黄金</td>
                                <td class="align-right"><span class="text-danger">3349.32</span></td>
                                <td class="align-right" width="90"><span class="text-danger">+1.78%</span></td>
                                <td class="align-right" width="30"><span class="text-danger"><i class="fa fa-long-arrow-up"></i></span></td>
                              </tr>
                              <tr>
                                <td>布伦特原油</td>
                                <td class="align-right"><span class="text-success">23797.96</span></td>
                                <td class="align-right"><span class="text-success">-0.34%</span></td>
                                <td class="align-right"><span class="text-success"><i class="fa fa-long-arrow-down"></i></span></td>
                              </tr>
                              <tr>
                                <td>铜</td>
                                <td class="align-right"><span class="text-success">17895.22</span></td>
                                <td class="align-right"><span class="text-success">-1.47%</span></td>
                                <td class="align-right"><span class="text-success"><i class="fa fa-long-arrow-down"></i></span></td>
                              </tr>
                            </table>
                        </div>
                    </div>-->
                </div>
            </div>
        </div>
        <!--热门推荐-->
        <div class="panel" id="hotNews">
        	<include file="inchotnews" />
        </div>
    </div>
    <div class="clear"></div>
</div>
<!--主体结束-->
<!--底部开始-->
<include file="./foot" />
<!--底部结束-->
</body>
</html>
